package com.group56.view.userend;

import com.group56.MainApp;
import com.group56.ScheduleModuleApp;
import com.group56.UserInfoModuleApp;
import com.group56.factory.AppCMFactory;
import com.group56.factory.UserModuleCMFactory;
import com.group56.utils.FXMLSrcMenu;
import com.group56.utils.FXMLViewHandler;
import com.group56.view.FrameworkController;
import com.group56.view.ViewController;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.Parent;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

import java.io.IOException;

public class NavigationController implements ViewController {
    public Button video_button;
    public Button book_button;
    public Button schedule_button;
    public Button user_button;
    @FXML
    private VBox view;

    @Override
    public void registerToMediator() {
        UserModuleCMFactory.getCtrlrMediator().registerController(FXMLSrcMenu.UserEnd.NAVIGATOR.getSrc(),this);
        AppCMFactory.getCtrlrMediator().registerController(FXMLSrcMenu.UserEnd.NAVIGATOR.getSrc(),this);
    }

    @Override
    public Parent getView() {
        return view;
    }

    public void clickVideoBtn(ActionEvent actionEvent) throws IOException {
        FrameworkController appFramework = (FrameworkController)AppCMFactory.getCtrlrMediator().getController(FXMLSrcMenu.UserEnd.APP_FRAMEWORK.getSrc());
        FXMLViewHandler.putViewInPane(appFramework.getContentPane(),FXMLViewHandler.getView(FXMLSrcMenu.UserEnd.VIDEO_LIST.getSrc()));
    }

    public void clickBookBtn(ActionEvent actionEvent) throws IOException {
//        MainApp.showPrimaryStage(MainApp.coachListStage);
        FrameworkController appFramework = (FrameworkController)AppCMFactory.getCtrlrMediator().getController(FXMLSrcMenu.UserEnd.APP_FRAMEWORK.getSrc());
        FXMLViewHandler.putViewInPane(appFramework.getContentPane(),FXMLViewHandler.getView(FXMLSrcMenu.UserEnd.COACH_LIST.getSrc()));
    }

    public void clickUserBtn(ActionEvent actionEvent) throws IOException {
//        MainApp.showPrimaryStage(MainApp.customerInfoStage);
        FrameworkController appFramework = (FrameworkController)AppCMFactory.getCtrlrMediator().getController(FXMLSrcMenu.UserEnd.APP_FRAMEWORK.getSrc());
        FXMLViewHandler.putViewInPane(appFramework.getContentPane(),FXMLViewHandler.getView(FXMLSrcMenu.UserEnd.USER_FRAMEWORK.getSrc()));
    }

    public void clickScheduleBtn(ActionEvent actionEvent) throws Exception {
//        MainApp.showPrimaryStage(MainApp.scheduleListStage);
        FrameworkController appFramework = (FrameworkController)AppCMFactory.getCtrlrMediator().getController(FXMLSrcMenu.UserEnd.APP_FRAMEWORK.getSrc());
        FXMLViewHandler.putViewInPane(appFramework.getContentPane(),FXMLViewHandler.getView(FXMLSrcMenu.UserEnd.SCHEDULE_LIST.getSrc()));
    }
}
